#! /bin/sh /usr/share/dpatch/dpatch-run
## 04_make-isIllChar-more-strict.dpatch by Liu Yubao <yubao.liu@gmail.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: make isIllChar() more strict

@DPATCH@
diff -urNad qterm~/qterm/qtermbbs.cpp qterm/qterm/qtermbbs.cpp
--- qterm~/qterm/qtermbbs.cpp	2006-07-10 15:36:13.000000000 +0800
+++ qterm/qterm/qtermbbs.cpp	2007-10-10 05:54:10.000000000 +0800
@@ -281,10 +281,10 @@
 	return bSame;
 }
 
-bool QTermBBS::isIllChar(char ch)
+bool QTermBBS::isIllURLChar(char ch)
 {
 	static char illChars[] = ",;'\"()[]<>^";	
-	return ch>'~' || ch<'#' || strchr(illChars, ch) !=NULL;
+	return ch>'~' || ch<'#' || strchr(illChars, ch) !=NULL || isspace(ch);
 }
 
 bool QTermBBS::isUrl(QRect& rcUrl, QRect& rcOld)
@@ -332,9 +332,9 @@
 	int ip_begin = 0;
 	int ip_end = 0;
 
-	for (i=at; i>=0 && !isIllChar(cstrText.at(i)); i--);
+	for (i=at; i>=0 && !isIllURLChar(cstrText.at(i)); i--);
 	url = i+1;
-	for (i=at; i<cstrText.length() && !isIllChar(cstrText.at(i)); i++);
+	for (i=at; i<cstrText.length() && !isIllURLChar(cstrText.at(i)); i++);
 	end = i;
 
 	int nNoType = -1;
diff -urNad qterm~/qterm/qtermbbs.h qterm/qterm/qtermbbs.h
--- qterm~/qterm/qtermbbs.h	2006-07-10 15:36:13.000000000 +0800
+++ qterm/qterm/qtermbbs.h	2007-10-10 05:54:10.000000000 +0800
@@ -41,7 +41,7 @@
 	
 protected:
 	bool isUnicolor( QTermTextLine * );
-	bool isIllChar(char);
+	bool isIllURLChar(char);
 	QTermBuffer *m_pBuffer;
 
 	QRect m_rcUrl;
